<?php
/**
 * 功能描述：	系统用户登录
 * @datetime	2022-07-08
 * @version   	v2.3.0
 * @author   	ZHL
 * @copyrigh  	2022 ZHL 版权所有
 */

class Admin_LoginModel extends Model {

    /**
     * Notes:账号/手机/邮箱 登录 验证用户信息
     * User: ZhuHaili
     * Date: 2022/7/8
     */
    function getUserInfoOther($manageUser, $pwd){
        $db = $this->conn('mysql');
        $pwd = $db->sqlStr($pwd);
        $manageUser = $db->sqlStr($manageUser);
        $sql['field'] = 'id,title,title nickname,headimg,pwd,mobile,email,levels,status,createdate,logincount';
        $sql['table'] = 'sysuser';
        $sql['where'] =  "and pwd=$pwd and (title=$manageUser or mobile=$manageUser or email=$manageUser)";
        return $db->find($sql);
    }

	/**
	 * @fun		获取用户信息
	 * @desc	账号密码
	 * @date	2022/7/8
	 */
	function getUserInfoUser($manageUser, $pwd){
        $db = $this->conn('mysql');
        $pwd = $db->sqlStr($pwd);
        $manageUser = $db->sqlStr($manageUser);
        $sql['field'] = 'id,title,title nickname,headimg,pwd,mobile,email,levels,status,createdate,logincount';
        $sql['table'] = 'sysuser';
        $sql['where']['title'] = $manageUser;
        $sql['where']['pwd'] = $pwd;
        return $db->find($sql);
	}

    /**
     * Notes:根据Id获取用户基本信息
     * User: ZhuHaili
     * Date: 2022/7/8
     */
    function getUserInfoNo($id){
        $sql['field'] = 'u.*,u.title nickname';
        $sql['table'] = 'sysuser';
        $sql['as'] = 'u';
        $sql['where']['id'] = $id;
        $db = $this->conn('mysql');
        return $db->find($sql);
    }
}